/*
 * FSplitString.java
 *
 * Created on 17 February 2005, 20:42
 */

package org.foment.joliage3.core.string;

/**
 *
 * @author civan
 */
  public class SplitString {
    public String pre;
    public String main;
    public String post;
    public boolean found;
    public SplitString(String toSplit, String patternBegin, String patternEnd) {
      int openPosition = toSplit.indexOf(patternBegin);
      int closePosition = toSplit.indexOf(patternEnd);
      if (openPosition == -1 || closePosition == -1) {
        pre = "";
        main = toSplit;
        post = "";
        found = false;
      } else {
        pre = toSplit.substring(0, openPosition);
        main = toSplit.substring(openPosition + patternBegin.length(), closePosition);
        post = toSplit.substring(closePosition + patternEnd.length());
        found = true;
      }
    }
  }